﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NCT.INVPOS.DataAccessLayer.Entity;

namespace NCT.INVPOS.DataAccessLayer.Configurations
{
    public class CategoryConfiguration : EntityTypeConfiguration<Category>
    {
        public CategoryConfiguration()
        {
            HasKey(P => P.Id);
            Property(P => P.Name).IsRequired().HasMaxLength(30);

            HasMany(P => P.Products).WithOptional(P => P.Category).HasForeignKey(P => P.CategoryId);
        }
    }
}
